<template>
    <div>
        <TableHead
            :config="tableHeaderConfig"
            :searchdata.sync="filters"
            @parentPageList="findPage()"
            :tabinline="true"
            v-show="showSearch"
        ></TableHead>
        <el-card class="card-box">
            <TableToolBar :showSearch.sync="showSearch" @queryTable="findPage" :columns="columns"></TableToolBar>
            <Table
                v-model="pageRequest.pageNum"
                :data="dataList"
                :total="total"
                :columns="columns"
                :loading="loading"
                :showNo="true"
            ></Table>
        </el-card>
    </div>
</template>
<script>
import { fetLoglogin } from '@/api/system/log'
import TableToolBar from '@/components/TableToolBar'
export default {
    name: 'loglogin',
    components: {
        TableToolBar
    },
    data() {
        return {
            loading: false,
            showSearch: true,
            pageRequest: { pageNum: 1, pageSize: 10 },
            filters: { userName: '' },
            tableHeaderConfig: [{ title: '用户名', code: 'userName', type: 'input' }],
            // 表格的列参配置
            columns: [
                { prop: 'username', label: '用户名', minWidth: 100, visible: true, key: 'username' },
                { prop: 'ip', label: '用户名ip', minWidth: 100, visible: true, key: 'ip' },
                { type: 'createUser', label: '创建人/创建时间', minWidth: 120, visible: true, key: 'createUser' },
                { type: 'updateUser', label: '更新人/更新时间', minWidth: 100, visible: true, key: 'updateUser' }
            ],
            dataList: [],
            total: 0
        }
    },
    methods: {
        findPage() {
            const params = Object.assign({}, this.pageRequest, this.filters)
            console.log('params', params)
            fetLoglogin(params).then((res) => {
                console.log(res)
            })
        }
    },
    mounted() {
        this.findPage()
    }
}
</script>
